/**
* v-imgLazy 图片懒加载
* Copyright (c) 2022 ruoyi
*/

export default {
  async mounted(el, binding, vnode) {
    const defaultImg = await import('@/assets/logo/logo.png')
    el.src = defaultImg.default;
    // IntersectionObserver 是否可以实现虚拟列表
    const observer = new IntersectionObserver((enr)=>{
      if(enr[0].intersectionRatio > 0){
        el.src = binding.value;
        observer.unobserve(el)
      }
    })
    observer.observe(el)
  }
}
